<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
		}
		body{
			text-align: center;
		}
		.box{
			width: 90%;
			height: 50px;
			background-color: red;
			margin: 0 auto;
			position: sticky;
/*			粘性定位*/
			top: 0;
/*			元素距离浏览器顶部 等于或小于0 则变为固定定位 反正是相对*/
			margin-top: 50px;
		}
	</style>
</head>
<body>

	<div class="box"></div>
	<img src="../image/1.jpg">
	<img src="../image/2.jpg">
	<img src="../image/3.jpg">
	<img src="../image/4.jpg">
	<img src="../image/5.jpg">
	<img src="../image/01.png">
</body>
</html>